<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ include file="../baselayout/import.jsp"%>
<%@ taglib uri="http://www.bjtu.edu.cn/taglibs" prefix="wt" %>  
<div class="page-header">
  <h1>word2vec 模型</h1>
</div>
<div id='w2v'>
<c:choose>
     <c:when test="${isConnected}">
     		<div class="header ">
				<h1 >模型服务器成功连接</h1>
			</div>	
			<c:choose>
				<c:when test="${isExist}">
					<!-- 显示模型信息 -->
					<%-- <button class="btn btn-primary" data-ajax='{"url":"${staticPath}/admin/task/dotask.do","params":{"key1":"val1","key2":"val2"}}' type="button">加载模型</button> --%>
					显示模型信息.
					${modelInfo.modeName}
					${modelInfo.time}
				</c:when>
				<c:otherwise>
					<!-- 加载模型 -->
						<div class="text-center" style="margin:20px 0 0 0">
							<h3>模型服务器成功连接,但是模型尚未加载</h3>
							<button class="btn btn-primary" data-ajax='{"url":"${staticPath}/admin/task/dotask.do","params":{"command_type":"reflect","context_class":"Word2VecLoadModel"}}' type="button">
								加载模型
							</button>
						</div>
				</c:otherwise>
			</c:choose>	     	
     </c:when>
     <c:otherwise>
		   	<div class="header">
				<h1>模型服务器连接失败,请检查服务.</h1>
				<h2>${msg}</h2>
				<button data-command-seq=0 class="btn btn-warning">查询数据集</button>
			</div>
     </c:otherwise>
</c:choose>
<div id="result"></div>

<script>
!function(w){
	'use strict'
	w.compileAjaxButtons('#w2v',function(){});
	
/* 	var uris = ['Word2VecDatasetQuery','Word2VecModelQuery','Word2VecDocTrans','Word2VecFileTrans'];
	var method = ['get','get','post','post'];
	function succHandler(data){
		$("#result").html(data);
	}
	function errHandler(err){
		console.log(err);
	}
	function createClickHandler(uri,method){
		return function(){
			$.ajax({
				url:'task/dotask.do',
				type:method,
				data:{
					'command_type':'reflect',
					'context_class':uri
				},
				success:succHandler,
				error:errHandler
			})
		}
	}
	$("button[data-command-seq]").each(function(){
		var $this = $(this);
		var idx = parseInt($this.attr('data-command-seq'));
		$this.click(createClickHandler(uris[idx],method[idx]));
	}) */
}(window);
</script>



<!--<button data-command-seq=0 class="btn btn-warning">查询数据集</button>
					<form action="${staticPath}/admin/task/dotask.do" method="post" target="_blank">
						<textarea style="width:100%;min-height:200px" id="text" name = "command_text_trans" ></textarea>
						<input name="command_type" type="hidden" value="command_type_word2vec_trans">
						<div class="text-center" style="margin:20px 0 0 0">
							<input class="btn btn-primary" type="submit" value="转换向量">
							<button class="btn btn-primary" type="button">类别预测</button>
						</div>
					</form>  -->
</div>
